Local System Installation
Installation and setup instructions while doing the configuration on a new system.
Frontend
Installing nodejs
- As of November 21, 2022, GQC uses
Node v16 LTSfor its development. - In the coming months, as
v16will get deprecated, GQC will switch toNode v18 LTS
Installing node_modules
- GQC prefers using
yarnas it's global node manager manager. - Clone the repo and run the command
yarn install - Once the
node_modulesare installed, runyarn startto run the frontend server.
Defining Environment Variables
- In the root level of the react application, create a file called
.env - Make sure the following variables are defined:
# #############################################################################
# For development environments:
# #############################
NODE_ENV=development
REACT_APP_PROXY_PROTOCOL=http
REACT_APP_PROXY_URL=127.0.0.1
# The Proxy Port should point at the DRF instance's port
REACT_APP_PROXY_PORT=8000
REACT_APP_PROXY_SECURE=false
# If running DRF locally, the API URL should point at the React App's URL
REACT_APP_API_URL=http://127.0.0.1:3001/
# If relying on a hosted DRF, then the API URL should point at the hosted DRF:
# REACT_APP_API_URL=https://www.ohioriver.org/
# #############################################################################
Backend
Installing packages from requirements.txt
- Create a new
virtualenvusing the commandmkvirtualenv <env name> - Install the requirements using
pip install -r requirements.txt
Setting up the postgres database
- Launch
pgadmin - Create a new database called
orsanco_flows - Right click on Extensions and install
timescaledbin the database. - Go back to the repo and
- Iif a migrations folder does NOT exist
- Create a
migrationsfolder at the root level and add__init__.pyinside the folder; resulting in te following folder structureorsanco_backend
migrations/
__init__.py
manage.py
.gitignore
requirement.txt
- and launch a terminal window.
- Run the following commands
python manage.py makemigrations
python manage.py migrate
python manage.py setup_cross_sections
python manage.py download_hdf_ftp
Configuring HDF Downloader and Processor (Linux)
- SSH into the NOAA FTP server once to get it stored in your user's known hosts (NOTE that you don't need to actually type in your password/connect, you just need to try to connect and select YES when asked to remember/trust this host):
ssh skshirsagar@data7.erh.noaa.gov - Update the SSHPASS variable stored in
cron-ftp-flows.sh - Define the cron job:
- Set your default editor to nano by using the following command, then typing in nano:
select-editor - Edit the crontab configuration:
crontab -e - Add your crontab configuration as a new line at the bottom of the file. The cron job on the VM is
0 20 * * * ~/cron-ftp-flows.sh >> ~/cron.logwhich translates to "run the shell script at 0 minutes and 20 hours of every day". Note that the "20 hours" time is local to the machine, meaning ET on Microcenter or UTC on VMs.
- Set your default editor to nano by using the following command, then typing in nano: